package boot

import (
	"chrent.com/ServiceManage/boot/ds"
	"chrent.com/ServiceManage/boot/setting"
	"chrent.com/ServiceManage/utils"
	"fmt"
	"github.com/gin-gonic/gin"
	"os"
)

var e *gin.Engine

func Setup() *gin.Engine {
	if setting.Conf.Production {
		gin.SetMode(gin.ReleaseMode)
	}
	e = gin.Default()
	os.Setenv("PMON2_CONF", utils.GetPm2Conf())
	Routes()
	ds.InitDb()
	return e
}
func initWwwConf() {
	conftxt := `window.__PRODUCTION__ADMINPRO__CONF__={"VITE_GLOB_APP_TITLE":"服务管理","VITE_GLOB_APP_SHORT_NAME":"服务管理","VITE_GLOB_PROD_MOCK":"true","VITE_GLOB_API_URL":"%s","VITE_GLOB_UPLOAD_URL":"","VITE_GLOB_IMG_URL":"","VITE_GLOB_API_URL_PREFIX":""};Object.freeze(window.__PRODUCTION__ADMINPRO__CONF__);Object.defineProperty(window,"__PRODUCTION__ADMINPRO__CONF__",{configurable:false,writable:false,});`
	conftxt = fmt.Sprintf(conftxt, setting.Conf.Domain)

}
